package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.ProvinceExtMapper;
import com.mhc.suzuki.dal.model.ProvinceDO;
import com.mhc.suzuki.dal.query.ProvinceQuery;
import com.mhc.suzuki.manager.ProvinceManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Province.
 */

@Component
public class ProvinceManagerImpl implements ProvinceManager{

    
    @Autowired
    protected ProvinceExtMapper provinceExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(ProvinceQuery query){
        return provinceExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(ProvinceQuery query){
        return provinceExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(ProvinceDO record){
        return provinceExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(ProvinceDO record){
        return provinceExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<ProvinceDO> selectByQuery(ProvinceQuery query){
        return provinceExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<ProvinceDO> selectByQueryWithPage(ProvinceQuery query) {
        PageResult<ProvinceDO> result = new PageResult<ProvinceDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public ProvinceDO selectByPrimaryKey(Long id){
        return provinceExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( ProvinceDO record,  ProvinceQuery query){
        return provinceExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( ProvinceDO record,  ProvinceQuery query){

        return provinceExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(ProvinceDO record){
        return provinceExtMapper.updateByPrimaryKeySelective(record);
    }
}